Add mount & Change select to radio

Brightcells 7 年之前
父节点
当前提交
792715afdf

+ 3 - 11
account/models.py

@@ -4,7 +4,7 @@ from django.db import models
4 4
 from django.utils.translation import ugettext_lazy as _
5 5
 from shortuuidfield import ShortUUIDField
6 6
 
7
-from tamron.basemodels import CreateUpdateMixin
7
+from tamron.basemodels import CreateUpdateMixin, SexChoicesMixin
8 8
 
9 9
 
10 10
 class FranchiserInfo(CreateUpdateMixin):
@@ -30,15 +30,7 @@ class FranchiserInfo(CreateUpdateMixin):
30 30
         }
31 31
 
32 32
 
33
-class SaleclerkInfo(CreateUpdateMixin):
34
-    MALE = 1
35
-    FEMALE = 0
36
-
37
-    SEX_TYPE = (
38
-        (MALE, u'男'),
39
-        (FEMALE, u'女'),
40
-    )
41
-
33
+class SaleclerkInfo(CreateUpdateMixin, SexChoicesMixin):
42 34
     REFUSED = -1
43 35
     UNVERIFIED = 0
44 36
     ACTIVATED = 1
@@ -59,7 +51,7 @@ class SaleclerkInfo(CreateUpdateMixin):
59 51
     franchiser_name = models.CharField(_(u'franchiser_name'), max_length=255, blank=True, null=True, help_text=u'经销商名称')
60 52
     clerk_id = ShortUUIDField(_(u'clerk_id'), max_length=255, help_text=u'店员唯一标识', db_index=True, unique=True)
61 53
     clerk_name = models.CharField(_(u'clerk_name'), max_length=255, blank=True, null=True, help_text=u'店员名称')
62
-    clerk_sex = models.IntegerField(_(u'clerk_sex'), choices=SEX_TYPE, default=MALE, help_text=u'店员性别', db_index=True)
54
+    clerk_sex = models.IntegerField(_(u'clerk_sex'), choices=SexChoicesMixin.SEX_TYPE, default=SexChoicesMixin.MALE, help_text=u'店员性别', db_index=True)
63 55
     clerk_phone = models.CharField(_(u'clerk_phone'), max_length=255, blank=True, null=True, help_text=u'店员联系电话')
64 56
 
65 57
     openid = models.CharField(_(u'openid'), max_length=255, blank=True, null=True, help_text=u'微信 OpenID', db_index=True, unique=True)

+ 7 - 5
page/sale_views.py

@@ -40,6 +40,7 @@ def clerk_sale_submit_api(request):
40 40
 
41 41
     clerk_id = request.POST.get('clerk_id', '')
42 42
     model_id = request.POST.get('model_id', '')
43
+    mount = request.POST.get('mount', 'NO')
43 44
     code = request.POST.get('code', '')
44 45
     name = request.POST.get('name', '')
45 46
     sex = int(request.POST.get('sex', 1))
@@ -66,6 +67,7 @@ def clerk_sale_submit_api(request):
66 67
     ProductCodeSubmitLogInfo.objects.create(
67 68
         model_id=model.model_id,
68 69
         model_name=model.model_name,
70
+        mount=mount,
69 71
         code=code,
70 72
         franchiser_id=clerk.franchiser_id,
71 73
         clerk_id=clerk.clerk_id,
@@ -77,7 +79,7 @@ def clerk_sale_submit_api(request):
77 79
 
78 80
     # 产品是否存在
79 81
     try:
80
-        product = ProductInfo.objects.select_for_update().get(model_id=model_id, code=code)
82
+        product = ProductInfo.objects.select_for_update().get(model_id=model_id, mount=mount, code=code)
81 83
     except ProductInfo.DoesNotExist:
82 84
         return response(ProductStatusCode.PRODUCT_NOT_FOUND)
83 85
 
@@ -92,13 +94,13 @@ def clerk_sale_submit_api(request):
92 94
     product.integral_status = True
93 95
     product.franchiser_id = clerk.franchiser_id
94 96
     product.clerk_id = clerk.clerk_id
95
-    if name:
97
+    if 'name' in request.POST:
96 98
         product.consumer_name = name
97
-    if sex:
99
+    if 'sex' in request.POST:
98 100
         product.consumer_sex = sex
99
-    if age:
101
+    if 'age' in request.POST:
100 102
         product.consumer_age = age
101
-    if phone:
103
+    if 'phone' in request.POST:
102 104
         product.consumer_phone = phone
103 105
     product.save()
104 106
 

+ 176 - 24
page/templates/page/clerk_sale.html

@@ -18,6 +18,14 @@
18 18
             input:required:valid {
19 19
                 color: rgb(0, 0, 0);
20 20
             }
21
+            .radio_cells {
22
+                margin-top: 0;
23
+                margin-left: 15px;
24
+            }
25
+            .radio_cells>label {
26
+                padding: 5px 10px;
27
+                font-size: 13px;
28
+            }
21 29
         </style>
22 30
     </head>
23 31
     <body>
@@ -25,16 +33,79 @@
25 33
             <div id="machine_info">
26 34
                 <div class="weui_cells_title">机器信息</div>
27 35
                 <div class="weui_cells weui_cells_form">
28
-                    <div class="weui_cell weui_cell_select weui_select_after">
36
+{#                    <div class="weui_cell weui_cell_select weui_select_after">#}
37
+{#                        <div class="weui_cell_hd"><label for="" class="weui_label">型号</label></div>#}
38
+{#                        <div class="weui_cell_bd weui_cell_primary">#}
39
+{#                            <select id="model" class="weui_select" name="select">#}
40
+{#                                {% for model in models %}#}
41
+{#                                <option value="{{ model.model_id }}">{{ model.model_name }}</option>#}
42
+{#                                {% endfor %}#}
43
+{#                            </select>#}
44
+{#                        </div>#}
45
+{#                    </div>#}
46
+                    <div class="weui_cell">
29 47
                         <div class="weui_cell_hd"><label for="" class="weui_label">型号</label></div>
30 48
                         <div class="weui_cell_bd weui_cell_primary">
31
-                            <select id="model" class="weui_select" name="select">
32
-                                {% for model in models %}
33
-                                <option value="{{ model.model_id }}">{{ model.model_name }}</option>
34
-                                {% endfor %}
35
-                            </select>
49
+                            <input id="model" class="weui_input" type="text" value="" placeholder="请选择相机型号" disabled>
36 50
                         </div>
37 51
                     </div>
52
+                    <div id="model_radio" class="weui_cells weui_cells_radio radio_cells">
53
+                        {% for model in models %}
54
+                        <label class="weui_cell weui_check_label" for="{{ model.model_id }}">
55
+                            <div class="weui_cell_bd weui_cell_primary">
56
+                                <li type="circle">{{ model.model_name }}</li>
57
+                            </div>
58
+                            <div class="weui_cell_ft">
59
+                                <input type="radio" class="weui_check" name="model" id="{{ model.model_id }}" value="{{ model.model_id }}" {% if forloop.first %}checked="checked"{% endif %}>
60
+                                <span class="weui_icon_checked"></span>
61
+                            </div>
62
+                        </label>
63
+                        {% endfor %}
64
+                    </div>
65
+                    <div class="weui_cell">
66
+                        <div class="weui_cell_hd"><label for="" class="weui_label">卡口</label></div>
67
+                        <div class="weui_cell_bd weui_cell_primary">
68
+                            <input id="mount" class="weui_input" type="text" value="" placeholder="请选择相机卡口" disabled>
69
+                        </div>
70
+                    </div>
71
+                    <div id="mount_radio" class="weui_cells weui_cells_radio radio_cells">
72
+                        <label class="weui_cell weui_check_label" for="e">
73
+                            <div class="weui_cell_bd weui_cell_primary">
74
+                                <li type="circle">E</li>
75
+                            </div>
76
+                            <div class="weui_cell_ft">
77
+                                <input type="radio" class="weui_check" name="mount" id="e" value="E" checked="checked">
78
+                                <span class="weui_icon_checked"></span>
79
+                            </div>
80
+                        </label>
81
+                        <label class="weui_cell weui_check_label" for="n">
82
+                            <div class="weui_cell_bd weui_cell_primary">
83
+                                <li type="circle">N</li>
84
+                            </div>
85
+                            <div class="weui_cell_ft">
86
+                                <input type="radio" class="weui_check" name="mount" id="n" value="N">
87
+                                <span class="weui_icon_checked"></span>
88
+                            </div>
89
+                        </label>
90
+                        <label class="weui_cell weui_check_label" for="s">
91
+                            <div class="weui_cell_bd weui_cell_primary">
92
+                                <li type="circle">S</li>
93
+                            </div>
94
+                            <div class="weui_cell_ft">
95
+                                <input type="radio" class="weui_check" name="mount" id="s" value="S">
96
+                                <span class="weui_icon_checked"></span>
97
+                            </div>
98
+                        </label>
99
+                        <label class="weui_cell weui_check_label" for="p">
100
+                            <div class="weui_cell_bd weui_cell_primary">
101
+                                <li type="circle">P</li>
102
+                            </div>
103
+                            <div class="weui_cell_ft">
104
+                                <input type="radio" class="weui_check" name="mount" id="p" value="P">
105
+                                <span class="weui_icon_checked"></span>
106
+                            </div>
107
+                        </label>
108
+                    </div>
38 109
                     <div class="weui_cell">
39 110
                         <div class="weui_cell_hd"><label for="" class="weui_label">机身码</label></div>
40 111
                         <div class="weui_cell_bd weui_cell_primary">
@@ -58,27 +129,106 @@
58 129
                             <input id="name" class="weui_input" type="text" value="" placeholder="请输入消费者姓名">
59 130
                         </div>
60 131
                     </div>
61
-                    <div class="weui_cell weui_cell_select weui_select_after">
132
+{#                    <div class="weui_cell weui_cell_select weui_select_after">#}
133
+{#                        <div class="weui_cell_hd"><label for="" class="weui_label">性别</label></div>#}
134
+{#                        <div class="weui_cell_bd weui_cell_primary">#}
135
+{#                            <select id="sex" class="weui_select" name="select">#}
136
+{#                                <option value="1">男</option>#}
137
+{#                                <option value="0">女</option>#}
138
+{#                            </select>#}
139
+{#                        </div>#}
140
+{#                    </div>#}
141
+                    <div class="weui_cell">
62 142
                         <div class="weui_cell_hd"><label for="" class="weui_label">性别</label></div>
63 143
                         <div class="weui_cell_bd weui_cell_primary">
64
-                            <select id="sex" class="weui_select" name="select">
65
-                                <option value="1">男</option>
66
-                                <option value="0">女</option>
67
-                            </select>
144
+                            <input id="sex" class="weui_input" type="text" value="" placeholder="请选择消费者性别" disabled>
68 145
                         </div>
69 146
                     </div>
70
-                    <div class="weui_cell weui_cell_select weui_select_after">
71
-                        <div class="weui_cell_hd"><label for="" class="weui_label">年龄</label></div>
147
+                    <div id="sex_radio" class="weui_cells weui_cells_radio radio_cells">
148
+                        <label class="weui_cell weui_check_label" for="male">
149
+                            <div class="weui_cell_bd weui_cell_primary">
150
+                                <li type="circle">先生</li>
151
+                            </div>
152
+                            <div class="weui_cell_ft">
153
+                                <input type="radio" class="weui_check" name="sex" id="male" value="1" checked="checked">
154
+                                <span class="weui_icon_checked"></span>
155
+                            </div>
156
+                        </label>
157
+                        <label class="weui_cell weui_check_label" for="female">
158
+                            <div class="weui_cell_bd weui_cell_primary">
159
+                                <li type="circle">女士</li>
160
+                            </div>
161
+                            <div class="weui_cell_ft">
162
+                                <input type="radio" class="weui_check" name="sex" id="female" value="0">
163
+                                <span class="weui_icon_checked"></span>
164
+                            </div>
165
+                        </label>
166
+                    </div>
167
+{#                    <div class="weui_cell weui_cell_select weui_select_after">#}
168
+{#                        <div class="weui_cell_hd"><label for="" class="weui_label">年龄</label></div>#}
169
+{#                        <div class="weui_cell_bd weui_cell_primary">#}
170
+{#                            <select id="age" class="weui_select" name="select">#}
171
+{#                                <option value="1">20周岁以下</option>#}
172
+{#                                <option value="2">20~30周岁</option>#}
173
+{#                                <option value="3">30~40周岁</option>#}
174
+{#                                <option value="4">40~50周岁</option>#}
175
+{#                                <option value="5">50周岁以上</option>#}
176
+{#                            </select>#}
177
+{#                        </div>#}
178
+{#                    </div>#}
179
+                    <div class="weui_cell">
180
+                        <div class="weui_cell_hd"><label for="" class="weui_label">年龄段</label></div>
72 181
                         <div class="weui_cell_bd weui_cell_primary">
73
-                            <select id="age" class="weui_select" name="select">
74
-                                <option value="1">20周岁以下</option>
75
-                                <option value="2">20~30周岁</option>
76
-                                <option value="3">30~40周岁</option>
77
-                                <option value="4">40~50周岁</option>
78
-                                <option value="5">50周岁以上</option>
79
-                            </select>
182
+                            <input id="age" class="weui_input" type="text" value="" placeholder="请选择消费者年龄段" disabled>
80 183
                         </div>
81 184
                     </div>
185
+                    <div id="age_radio" class="weui_cells weui_cells_radio radio_cells">
186
+                        <label class="weui_cell weui_check_label" for="age1">
187
+                            <div class="weui_cell_bd weui_cell_primary">
188
+                                <li type="circle">20周岁以下</li>
189
+                            </div>
190
+                            <div class="weui_cell_ft">
191
+                                <input type="radio" class="weui_check" name="age" id="age1" value="1" checked="checked">
192
+                                <span class="weui_icon_checked"></span>
193
+                            </div>
194
+                        </label>
195
+                        <label class="weui_cell weui_check_label" for="age2">
196
+                            <div class="weui_cell_bd weui_cell_primary">
197
+                                <li type="circle">20~30周岁</li>
198
+                            </div>
199
+                            <div class="weui_cell_ft">
200
+                                <input type="radio" class="weui_check" name="age" id="age2" value="2">
201
+                                <span class="weui_icon_checked"></span>
202
+                            </div>
203
+                        </label>
204
+                        <label class="weui_cell weui_check_label" for="age3">
205
+                            <div class="weui_cell_bd weui_cell_primary">
206
+                                <li type="circle">30~40周岁</li>
207
+                            </div>
208
+                            <div class="weui_cell_ft">
209
+                                <input type="radio" class="weui_check" name="age" id="age3" value="3">
210
+                                <span class="weui_icon_checked"></span>
211
+                            </div>
212
+                        </label>
213
+                        <label class="weui_cell weui_check_label" for="age4">
214
+                            <div class="weui_cell_bd weui_cell_primary">
215
+                                <li type="circle">40~50周岁</li>
216
+                            </div>
217
+                            <div class="weui_cell_ft">
218
+                                <input type="radio" class="weui_check" name="age" id="age4" value="4">
219
+                                <span class="weui_icon_checked"></span>
220
+                            </div>
221
+                        </label>
222
+                        <label class="weui_cell weui_check_label" for="age5">
223
+                            <div class="weui_cell_bd weui_cell_primary">
224
+                                <li type="circle">50周岁以上</li>
225
+                            </div>
226
+                            <div class="weui_cell_ft">
227
+                                <input type="radio" class="weui_check" name="age" id="age5" value="5">
228
+                                <span class="weui_icon_checked"></span>
229
+                            </div>
230
+                        </label>
231
+                    </div>
82 232
                     <div class="weui_cell">
83 233
                         <div class="weui_cell_hd"><label for="" class="weui_label">手机号</label></div>
84 234
                         <div class="weui_cell_bd weui_cell_primary">
@@ -154,7 +304,8 @@
154 304
                     return {
155 305
                         step: 1,
156 306
                         clerk_id: clerk_id,
157
-                        model_id: $('#model option:checked').val(),
307
+                        model_id: $("#model_radio input[name='model']:checked").val(),
308
+                        mount: $("#mount_radio input[name='mount']:checked").val(),
158 309
                         code: code,
159 310
                     }
160 311
                 }
@@ -187,11 +338,12 @@
187 338
                     return {
188 339
                         step: 2,
189 340
                         clerk_id: clerk_id,
190
-                        model_id: $('#model option:checked').val(),
341
+                        model_id: $("#model_radio input[name='model']:checked").val(),
342
+                        mount: $("#mount_radio input[name='mount']:checked").val(),
191 343
                         code: code,
192 344
                         name: name,
193
-                        sex: $('#sex option:checked').val(),
194
-                        age: $('#age option:checked').val(),
345
+                        sex: $("#sex_radio input[name='sex']:checked").val(),
346
+                        age: $("#age_radio input[name='age']:checked").val(),
195 347
                         phone: $('#phone').val(),
196 348
                     }
197 349
                 }

+ 4 - 4
product/admin.py

@@ -7,9 +7,9 @@ from product.models import ProductCodeSubmitLogInfo, ProductInfo, ProductModelIn
7 7
 
8 8
 class ProductModelInfoAdmin(admin.ModelAdmin):
9 9
     readonly_fields = ('model_id', )
10
-    list_display = ('model_id', 'model_name', 'integral', 'status', 'created_at', 'updated_at')
10
+    list_display = ('model_id', 'model_name', 'integral', 'has_mount', 'status', 'created_at', 'updated_at')
11 11
     search_fields = ('model_id', 'model_name')
12
-    list_filter = ('status', )
12
+    list_filter = ('has_mount', 'status')
13 13
 
14 14
 
15 15
 class ProductInfoAdmin(admin.ModelAdmin):
@@ -19,9 +19,9 @@ class ProductInfoAdmin(admin.ModelAdmin):
19 19
 
20 20
 
21 21
 class ProductCodeSubmitLogInfoAdmin(admin.ModelAdmin):
22
-    list_display = ('model_id', 'model_name', 'code', 'franchiser_id', 'clerk_id', 'consumer_name', 'consumer_sex', 'consumer_age', 'consumer_phone', 'status', 'created_at', 'updated_at')
22
+    list_display = ('model_id', 'model_name', 'mount', 'code', 'franchiser_id', 'clerk_id', 'consumer_name', 'consumer_sex', 'consumer_age', 'consumer_phone', 'status', 'created_at', 'updated_at')
23 23
     search_fields = ('model_id', 'model_name', 'code', 'consumer_name', 'consumer_phone')
24
-    list_filter = ('franchiser_id', 'consumer_sex', 'status')
24
+    list_filter = ('mount', 'franchiser_id', 'consumer_sex', 'status')
25 25
 
26 26
 
27 27
 admin.site.register(ProductModelInfo, ProductModelInfoAdmin)

+ 34 - 0
product/migrations/0003_auto_20170630_0220.py

@@ -0,0 +1,34 @@
1
+# -*- coding: utf-8 -*-
2
+from __future__ import unicode_literals
3
+
4
+from django.db import models, migrations
5
+
6
+
7
+class Migration(migrations.Migration):
8
+
9
+    dependencies = [
10
+        ('product', '0002_auto_20170619_1734'),
11
+    ]
12
+
13
+    operations = [
14
+        migrations.AddField(
15
+            model_name='productcodesubmitloginfo',
16
+            name='mount',
17
+            field=models.IntegerField(default=0, help_text='\u5361\u53e3', db_index=True, verbose_name='mount', choices=[(0, ''), (1, 'E'), (2, 'N'), (3, 'P'), (4, 'S')]),
18
+        ),
19
+        migrations.AddField(
20
+            model_name='productinfo',
21
+            name='mount',
22
+            field=models.IntegerField(default=0, help_text='\u5361\u53e3', db_index=True, verbose_name='mount', choices=[(0, ''), (1, 'E'), (2, 'N'), (3, 'P'), (4, 'S')]),
23
+        ),
24
+        migrations.AddField(
25
+            model_name='productmodelinfo',
26
+            name='has_mount',
27
+            field=models.BooleanField(default=True, help_text='\u662f\u5426\u6709\u5361\u53e3', db_index=True, verbose_name='has_mount'),
28
+        ),
29
+        migrations.AlterField(
30
+            model_name='productmodelinfo',
31
+            name='model_name',
32
+            field=models.CharField(null=True, max_length=255, blank=True, help_text='\u578b\u53f7\u540d\u79f0', unique=True, verbose_name='model_name'),
33
+        ),
34
+    ]

+ 24 - 0
product/migrations/0004_auto_20170630_0232.py

@@ -0,0 +1,24 @@
1
+# -*- coding: utf-8 -*-
2
+from __future__ import unicode_literals
3
+
4
+from django.db import models, migrations
5
+
6
+
7
+class Migration(migrations.Migration):
8
+
9
+    dependencies = [
10
+        ('product', '0003_auto_20170630_0220'),
11
+    ]
12
+
13
+    operations = [
14
+        migrations.AlterField(
15
+            model_name='productcodesubmitloginfo',
16
+            name='mount',
17
+            field=models.CharField(max_length=255, blank=True, help_text='\u5361\u53e3', null=True, verbose_name='mount', db_index=True),
18
+        ),
19
+        migrations.AlterField(
20
+            model_name='productinfo',
21
+            name='mount',
22
+            field=models.CharField(max_length=255, blank=True, help_text='\u5361\u53e3', null=True, verbose_name='mount', db_index=True),
23
+        ),
24
+    ]

+ 10 - 22
product/models.py

@@ -4,13 +4,14 @@ from django.db import models
4 4
 from django.utils.translation import ugettext_lazy as _
5 5
 from shortuuidfield import ShortUUIDField
6 6
 
7
-from tamron.basemodels import CreateUpdateMixin
7
+from tamron.basemodels import CreateUpdateMixin, SexChoicesMixin
8 8
 
9 9
 
10 10
 class ProductModelInfo(CreateUpdateMixin):
11 11
     model_id = ShortUUIDField(_(u'model_id'), max_length=255, help_text=u'型号唯一标识', db_index=True, unique=True)
12
-    model_name = models.CharField(_(u'model_name'), max_length=255, blank=True, null=True, help_text=u'型号名称')
12
+    model_name = models.CharField(_(u'model_name'), max_length=255, blank=True, null=True, help_text=u'型号名称', unique=True)
13 13
     integral = models.IntegerField(_(u'integral'), default=0, help_text=u'型号积分')
14
+    has_mount = models.BooleanField(_(u'has_mount'), default=True, help_text=u'是否有卡口', db_index=True)
14 15
 
15 16
     class Meta:
16 17
         verbose_name = _(u'产品型号信息')
@@ -25,21 +26,15 @@ class ProductModelInfo(CreateUpdateMixin):
25 26
             'model_id': self.model_id,
26 27
             'model_name': self.model_name,
27 28
             'integral': self.integral,
29
+            'has_mount': self.has_mount,
28 30
         }
29 31
 
30 32
 
31
-class ProductInfo(CreateUpdateMixin):
32
-    MALE = 1
33
-    FEMALE = 0
34
-
35
-    SEX_TYPE = (
36
-        (MALE, u'男'),
37
-        (FEMALE, u'女'),
38
-    )
39
-
33
+class ProductInfo(CreateUpdateMixin, SexChoicesMixin):
40 34
     model_id = models.CharField(_(u'model_id'), max_length=255, blank=True, null=True, help_text=u'型号唯一标识', db_index=True)
41 35
     model_name = models.CharField(_(u'model_name'), max_length=255, blank=True, null=True, help_text=u'型号名称', db_index=True)
42 36
 
37
+    mount = models.CharField(_(u'mount'), max_length=255, blank=True, null=True, help_text=u'卡口', db_index=True)
43 38
     code = models.CharField(_(u'code'), max_length=255, blank=True, null=True, help_text=u'机身码')
44 39
     code_status = models.BooleanField(_(u'code_status'), default=False, help_text=u'机身码状态, True已使用,False未使用', db_index=True)
45 40
 
@@ -50,7 +45,7 @@ class ProductInfo(CreateUpdateMixin):
50 45
     clerk_id = models.CharField(_(u'clerk_id'), max_length=255, blank=True, null=True, help_text=u'店员唯一标识', db_index=True)
51 46
 
52 47
     consumer_name = models.CharField(_(u'consumer_name'), max_length=255, blank=True, null=True, help_text=u'消费者名称')
53
-    consumer_sex = models.IntegerField(_(u'consumer_sex'), choices=SEX_TYPE, default=MALE, help_text=u'消费者性别', db_index=True)
48
+    consumer_sex = models.IntegerField(_(u'consumer_sex'), choices=SexChoicesMixin.SEX_TYPE, default=SexChoicesMixin.MALE, help_text=u'消费者性别', db_index=True)
54 49
     consumer_age = models.IntegerField(_(u'consumer_age'), default=0, help_text=u'消费者年龄')
55 50
     consumer_phone = models.CharField(_(u'consumer_phone'), max_length=255, blank=True, null=True, help_text=u'消费者联系电话')
56 51
 
@@ -70,24 +65,17 @@ class ProductInfo(CreateUpdateMixin):
70 65
         }
71 66
 
72 67
 
73
-class ProductCodeSubmitLogInfo(CreateUpdateMixin):
74
-    MALE = 1
75
-    FEMALE = 0
76
-
77
-    SEX_TYPE = (
78
-        (MALE, u'男'),
79
-        (FEMALE, u'女'),
80
-    )
81
-
68
+class ProductCodeSubmitLogInfo(CreateUpdateMixin, SexChoicesMixin):
82 69
     model_id = models.CharField(_(u'model_id'), max_length=255, blank=True, null=True, help_text=u'型号唯一标识', db_index=True)
83 70
     model_name = models.CharField(_(u'model_name'), max_length=255, blank=True, null=True, help_text=u'型号名称', db_index=True)
71
+    mount = models.CharField(_(u'mount'), max_length=255, blank=True, null=True, help_text=u'卡口', db_index=True)
84 72
     code = models.CharField(_(u'code'), max_length=255, blank=True, null=True, help_text=u'机身码')
85 73
 
86 74
     franchiser_id = models.CharField(_(u'franchiser_id'), max_length=255, blank=True, null=True, help_text=u'经销商唯一标识', db_index=True)
87 75
     clerk_id = models.CharField(_(u'clerk_id'), max_length=255, blank=True, null=True, help_text=u'店员唯一标识', db_index=True)
88 76
 
89 77
     consumer_name = models.CharField(_(u'consumer_name'), max_length=255, blank=True, null=True, help_text=u'消费者名称')
90
-    consumer_sex = models.IntegerField(_(u'consumer_sex'), choices=SEX_TYPE, default=MALE, help_text=u'消费者性别', db_index=True)
78
+    consumer_sex = models.IntegerField(_(u'consumer_sex'), choices=SexChoicesMixin.SEX_TYPE, default=SexChoicesMixin.MALE, help_text=u'消费者性别', db_index=True)
91 79
     consumer_age = models.IntegerField(_(u'consumer_age'), default=0, help_text=u'消费者年龄')
92 80
     consumer_phone = models.CharField(_(u'consumer_phone'), max_length=255, blank=True, null=True, help_text=u'消费者联系电话')
93 81
 

+ 13 - 0
tamron/basemodels.py

@@ -11,3 +11,16 @@ class CreateUpdateMixin(models.Model):
11 11
 
12 12
     class Meta:
13 13
         abstract = True
14
+
15
+
16
+class SexChoicesMixin(models.Model):
17
+    MALE = 1
18
+    FEMALE = 0
19
+
20
+    SEX_TYPE = (
21
+        (MALE, u'男'),
22
+        (FEMALE, u'女'),
23
+    )
24
+
25
+    class Meta:
26
+        abstract = True